package com.open.capacity.paper.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.open.capacity.common.exception.service.ServiceException;
import com.open.capacity.common.model.Option;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;

import java.util.Map;
import java.util.Set;


/**
 * @author liangd
 * @since 2021-01-29 17:24
 */
public interface OptionService extends IService<Option> {
    /**
     * 分页查询
     *
     * @param params Map<String, Object>
     * @return PageResult
     */
    PageResult<Option> getOptions(Map<String, Object> params) throws ServiceException;

    /**
     * 逻辑删除
     *
     * @param id 问题Id
     * @return Result
     */
    Result delete(Integer id) throws ServiceException;

    /**
     * 更新
     *
     * @param option Option
     * @return Result
     */
    Result updateOption(Option option) throws ServiceException;

    /**
     * 插入
     *
     * @param option Option
     * @return Result
     */
    Result saveOption(Option option) throws ServiceException;

    /**
     * 根据问题Id获取选项
     *
     * @param quesid 问题Id
     * @return Result
     */
    Result getOptionsByQuestionId(Integer quesid) throws ServiceException;

    /**
     * 给问题添加选项
     *
     * @param quesid    问题Id
     * @param optionIds 选项Ids
     * @return Result
     */
    Result addOptions(Integer quesid, Set<Integer> optionIds) throws ServiceException;
}
